import { http } from "../http";

const baseUrl = "/api/liveResource";

export interface LiveResourceType {
  id: string;
  areaName: string;
  channelName: string;
  signalStatus: number;
  previewUrl?: string;
  createTime: string;
}

export interface GetLiveResourceListQueryType {
  areaName?: string | null;
  channelName?: string | null;
  currentPage?: number | null;
  numPerPage?: number | null;
}
export interface GetLiveResourceListResponseType {
  list: LiveResourceType[];
  currentPage: number;
  numPerPage: number;
  totalCount: number;
  totalPages: number;
}

export interface AddOrUpdateLiveResourceQueryType {
  id?: string | null;
  areaName: string | null;
  channelName: string | null;
  signalStatus: number | null;
  previewUrl?: string | null;
}

export interface GetLiveResourceDetailQueryType {
  liveResourceId: string | null;
}

// 获取直播资源列表
export const getLiveResourceListAPI = (
  params: GetLiveResourceListQueryType
) => {
  return http.post(`${baseUrl}/getLiveResourceList`, params);
};

// 添加或编辑直播资源
export const addOrUpdateLiveResourceAPI = (
  params: AddOrUpdateLiveResourceQueryType
) => {
  return http.post(`${baseUrl}/addOrUpdateLiveResource`, params);
};

// 获取直播资源详情
export const getLiveResourceDetailAPI = (
  params: GetLiveResourceDetailQueryType
) => {
  return http.post(`${baseUrl}/getLiveResourceDetail`, params);
};
